﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DirectedGraphCycle
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }


    //class Program
    //{
    //    static void Main(string[] args)
    //    {
    //        //graph is presented by adjacency List
    //        //vertex is from 0,1,2,.., n
    //        //line 0 is the list of adjacency node wth vertex 0
    //        //line k is the list of adjacency node wth vertex k
    //        int[][] adjList = {new int[]{1,2,3},
    //                          new int[]{0,2},
    //                          new int[]{0,1},
    //                          new int[]{0}
    //                      };
    //        StrongConnectedComponents scc = new StrongConnectedComponents(adjList);
    //        for (int i = 0; i < adjList.Length; i++)
    //        {

    //            Console.Write("i: " + i + "\n");
    //            SCCResult r = scc.getStrongConnectedComponent(i);
    //            if (r != null)
    //            {
    //                ArrayList[] al = scc.getStrongConnectedComponent(i).getAdjList();
    //                for (int j = i; j < al.Length; j++)
    //                {
    //                    if (al[j].Count > 0)
    //                    {
    //                        Console.Write("j: " + j);
    //                        for (int k = 0; k < al[j].Count; k++)
    //                        {
    //                            Console.Write(" _" + al[j][k]);
    //                        }
    //                        Console.Write("\n");
    //                    }
    //                }
    //                Console.Write("\n");
    //            }
    //        }


    //        FindAllDirectedCycle ecs = new FindAllDirectedCycle(adjList);
    //        ArrayList cycles = ecs.getAllCycles();
    //        for (int i = 0; i < cycles.Count; i++)
    //        {
    //            ArrayList cycle = (ArrayList)cycles[i];
    //            for (int j = 0; j < cycle.Count; j++)
    //            {
    //                int node = (int)cycle[j];
    //                if (j < cycle.Count - 1)
    //                {
    //                    Console.Write(node + " -> ");
    //                }
    //                else
    //                {
    //                    Console.Write(node);
    //                }
    //            }
    //            Console.Write("\n");
    //        }

    //    }
    //}
}
